package com.cicigodd.brick.plug.common.response;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 统一API响应结果封装
 *
 * @author cicigodd
 * @date 2022/09/23 08:42:00
 */
@Data
public class Result<T> implements Serializable {
    @ApiModelProperty("请求状态码")
    private Integer code;
    @ApiModelProperty("请求成功true 请求失败false")
    private boolean success = true;
    @ApiModelProperty("请求状态信息")
    private String message;
    @ApiModelProperty("返回的数据")
    private T data;

    public Result setCode(Integer code) {
        this.code = code;
        return this;
    }

    public Result setMessage(String message) {
        this.message = message;
        return this;
    }

    public Result setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public Result setData(T data) {
        this.data = data;
        return this;
    }

}
